# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pager
pkgname=('python2-pager' 'python-pager')
_pkgname=pager
pkgver=3.3
pkgrel=10
pkgdesc='Terminal/console pager module for Python.'
arch=('any')
url='https://pypi.org/project/pager/#files'
license=('Public Domain')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('2c0b0cc4ce3c290f6892cbad1107019249458a27276ed6f41026f16af1a8cb42570c2757ec32bed6603d9ceea3098ea1bba951efe9bf92dd17e2078305dd5dda')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pager() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pager() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

